//============================================================================
// Name        : csiena
// Author      : Josh Lospinoso
// Copyright   : MIT License
// Description : Austere, limited implementation of the R package RSiena in
//				 C++. Used for fast maximum likelihood and method of moments
//				 estimation of stochastic actor oriented models (SAOMs)
//				 without any frills or user experience niceties.
//============================================================================

#ifndef CRIMP_H_
#define CRIMP_H_
#include "globals.h"
#include "chainElement.h"
#include "crimpEvaluation.h"
#include "mersenneTwister.h"

namespace csiena {

class ChainCrimp : public csiena::ChainElement {
public:
	ChainCrimp(int actors);
	virtual ~ChainCrimp();

	// Evaluation related methods
	void evaluate(Digraph* x, Evaluation* f);
	double evaluateProposal(Digraph* x, Evaluation* f);

	// Utility methods
	void print(int index);
	bool isCrimp();
	void simulate(Digraph* trueDigraph, Digraph* observedDigraph, CrimpEvaluation* f, MersenneTwister* r);

	// Accessor Methods
	double getScore(int gammaIndex);
	double getInformation(int gammaIndex1, int gammaIndex2);
	double getLogProbability();
	double getStatistic(int statisticIndex);

	// Ingredients for chain
	Digraph* observedDigraph;
private:
	void setLogProbability(double value);
	void setScore(int gammaIndex, double value);
	void setInformation(int gammaIndex1, int gammaIndex2, double value);
	void setStatistic(int statisticIndex, double value);
	int actors;
	double logProbability;
	double* score;
	double* information;
	double* statistic;
};

}

#endif /* CRIMP_H_ */
